<div class="panel-body">
    <div class="col-lg-6">
        <div class="panel-heading">
            <h3 class="panel-title">企业基本信息</h3>
        </div>
        <form class="panel-body form-horizontal form-padding">
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-text-input">单位名称</label>
                <div class="col-md-9">
                    <input type="text" id="companyName" name="companyName" value="${(companyInfo.name)!}" class="form-control" placeholder="">
                    <small class="help-block" id="name_err" style="display: none">请填入单位名称</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">社会信用代码</label>
                <div class="col-md-9">
                    <input type="text" id="creditCode" name="creditCode" value="${(companyInfo.creditCode)!}" class="form-control" placeholder="">
                    <small class="help-block" id="creditCode_err" style="display: none">请输入社会信用代码</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">法定代表人</label>
                <div class="col-md-9">
                    <input type="text" id="operName" name="operName" value="${(companyInfo.operName)!}" class="form-control" placeholder="">
                    <small class="help-block" id="operName_err" style="display: none">请输入法定代表人姓名</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">注册地址</label>
                <div class="col-md-9">
                    <input type="text" id="address" name="address" value="${(companyInfo.address)!}" class="form-control" placeholder="">
                    <small class="help-block" id="address_err" style="display: none">请输入注册地址</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">用电地址</label>
                <div class="col-md-9">
                    <input type="text" id="elecFor" name="elecFor" value="${(companyInfo.elecFor)!}" class="form-control" placeholder="">
                    <small class="help-block" id="elecFor_err" style="display: none">请输入用电地址</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">联系人</label>
                <div class="col-md-9">
                    <input type="text" id="contractName" name="contractName" value="${(companyInfo.contractName)!}" class="form-control" placeholder="">
                    <small class="help-block" id="contractName_err" style="display: none">请输入联系人姓名</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">联系人电话</label>
                <div class="col-md-9">
                    <input type="text" id="contractPhone" name="contractPhone" value="${(companyInfo.contractPhone)!}" class="form-control" placeholder="">
                    <small class="help-block" id="contractPhone_err" style="display: none">请输入联系人电话</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">微信号</label>
                <div class="col-md-9">
                    <input type="text" id="wxNum" name="wxNum" value="${(companyInfo.wxNum)!}" class="form-control" placeholder="">
                    <small class="help-block" id="wxNum_err" style="display: none">请输入微信号码</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">地理区域</label>
                <div class="col-md-3">
                    <select data-placeholder="请选择地级市" class="selectpicker" onchange="chooseArea()" id="parentId" tabindex="2">
                                        <#if cityList??>
                                            <#list cityList as c>
                                                <option value="${c.id}" <#if city?? && (c.id==city.parentId || c.id==city.id)>selected="selected"</#if> >${c.name}</option>
                                            </#list>
                                        </#if>
                    </select>
                </div>
                <div class="col-md-3">
                    <select data-placeholder="请选择区域" class="selectpicker" id="cityId" tabindex="2">
                                        <#if areaList??>
                                            <#list areaList as c>
                                                <option value="${c.id}" <#if city?? && c.id==city.id>selected="selected"</#if> >${c.name}</option>
                                            </#list>
                                        </#if>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">注册资本</label>
                <div class="col-md-9">
                    <input type="text" id="capital" name="capital" value="${(companyInfo.capital)!}" class="form-control" placeholder="">
                </div>
            </div>
        </form>
    </div>
    <div class="col-lg-6">
        <div class="panel-heading">
            <h3 class="panel-title">企业详细用电信息</h3>
        </div>
        <form class="panel-body form-horizontal form-padding">
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-text-input">电压等级（千伏）</label>
                <div class="col-md-9">
                    <select data-placeholder="请选择电压等级" class="selectpicker" id="voltageStep" name="voltageStep" tabindex="2">
                        <option value="0.4" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="0.4")>selected="selected"</#if> >0.4</option>
                        <option value="0.6" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="0.6")>selected="selected"</#if> >0.6</option>
                        <option value="10" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="10")>selected="selected"</#if> >10</option>
                        <option value="20" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="20")>selected="selected"</#if> >20</option>
                        <option value="35" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="35")>selected="selected"</#if> >35</option>
                        <option value="110" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="110")>selected="selected"</#if> >110</option>
                        <option value="220" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="220")>selected="selected"</#if> >220</option>
                    </select>
                    <span> （千伏）</span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">户号个数</label>
                <div class="col-md-9">
                    <#if (detailInfo.elecAccountNum)??>
                        <#assign accounts = detailInfo.elecAccountNum?split(",") >
                        <input type="text" id="accountNum" name="accountNum" value="${(accounts?size)!(0)}" class="form-control" placeholder="">
                    <#else>
                        <input type="text" id="accountNum" name="accountNum" class="form-control" placeholder="">
                    </#if>
                    <small class="help-block"  id="accountNum_error" style="display: none">请输入户号个数，且为数字类型</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">用电户号</label>
                <div class="col-md-9">
                    <textarea rows="3" placeholder="多个户号用逗号分隔" id="elecAccount" name="elecAccount" class="form-control" placeholder="">${(detailInfo.elecAccountNum)!}</textarea>
                    <small class="help-block" id="elecAccount_error"  style="display: none">请输入用电户号，用电户号由数字组成</small>
                </div>
            </div>
            <div class=" form-group row">
                <label class="col-md-3 control-label" for="demo-email-input">用户容量总计</label>
                <div class="col-md-7 input-group mar-btm">
                    <input type="text" class="form-control" id="transformerCapacity" name="transformerCapacity" value="${(detailInfo.transformerCapacity)!}" class="form-control" placeholder="">
                    <span class="input-group-addon">KVA(千伏安)</span>
                </div>
            </div>
            <div class="form-group row" id="transformerCapacity_err" style="display: none">
                <label class="col-md-3 control-label" for="demo-email-input"></label>
                <div class="col-md-6">
                    <small class="help-block">请输入用户容量总计，并请输入数字类型</small>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-md-3 control-label" for="demo-email-input">用户预估电量（年）</label>
                <div class="col-md-7 input-group mar-btm">
                    <input type="text" id="elecConsumption" name="elecConsumption" value="<#if (detailInfo.elecConsumption)??>${(detailInfo.elecConsumption)}</#if>" class="form-control" placeholder="">
                    <span class="input-group-addon">万kW·h(万度)/年</span>
                </div>
            </div>
            <div class="form-group"  id="elecConsumption_err" style="display: none">
                <label class="col-md-3 control-label" for="demo-email-input"></label>
                <div class="col-md-6">
                    <small class="help-block">请输入用户预估电量，并请输入数字类型</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">行业类别</label>
                <div class="col-md-9">
                    <select data-placeholder="请选择行业列表" class="selectpicker" id="detailCategory" name="detailCategory" tabindex="2">
                        <option value="工业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="工业")>selected="selected"</#if> >工业</option>
                        <option value="商业、住宿和餐饮业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="商业、住宿和餐饮业")>selected="selected"</#if> >商业、住宿和餐饮业</option>
                        <option value="建筑业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="建筑业")>selected="selected"</#if> >建筑业</option>
                        <option value="交通运输、仓储和邮政业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="交通运输、仓储和邮政业")>selected="selected"</#if> >交通运输、仓储和邮政业</option>
                        <option value="信息传输、计算机和软件业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="信息传输、计算机和软件业")>selected="selected"</#if> >信息传输、计算机和软件业</option>
                        <option value="金融、房地产、商务及居民服务业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="金融、房地产、商务及居民服务业")>selected="selected"</#if> >金融、房地产、商务及居民服务业</option>
                        <option value="公共事业及管理组织" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="公共事业及管理组织")>selected="selected"</#if> >公共事业及管理组织</option>
                        <option value="农、林、牧、渔业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="农、林、牧、渔业")>selected="selected"</#if> >农、林、牧、渔业</option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">开户银行</label>
                <div class="col-md-9">
                    <input type="text" id="bankName" name="bankName" value="${(detailInfo.bankName)!}" class="form-control" placeholder="">
                    <small class="help-block" id="bankName_err" style="display: none">请输入开户银行</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">开户名称</label>
                <div class="col-md-9">
                    <input type="text" id="bankAccountName" name="bankAccountName" value="${(detailInfo.bankAccountName)!}" class="form-control" placeholder="">
                    <small class="help-block" id="bankAccountName_err" style="display: none">请输入开户名称</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">开户账号</label>
                <div class="col-md-9">
                    <input type="text" id="bankAccount" name="bankAccount" value="${(detailInfo.bankAccount)!}" class="form-control" placeholder="">
                    <small class="help-block" id="bankAccount_err" style="display: none">请输入开户账号，请填入16~19位的数字</small>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-md-3 control-label" for="demo-email-input">办公电话</label>
                <div class="col-md-9 input-group mar-btm">
                    <input type="text" id="contactPhone" name="contactPhone" value="${(detailInfo.contactPhone)!}" class="form-control" placeholder="请输入办公电话，形如0512-67676767">
                </div>
            </div>
            <div class="form-group"  id="contactPhone_err" style="display: none">
                <label class="col-md-3 control-label" for="demo-email-input"></label>
                <div class="col-md-6">
                    <small class="help-block">请输入办公电话，形如"0512-67676767"</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">传真号码</label>
                <div class="col-md-9">
                    <input type="text" id="fax" name="fax" value="${(detailInfo.fax)!}" class="form-control" placeholder="">
                    <small class="help-block" id="fax_err" style="display: none">请输入传真号码</small>
                </div>
            </div>
        </form>

    </div>
    <div class="col-lg-6">
        <div class="panel-heading">
            <h3 class="panel-title">企业订购信息</h3>
        </div>
        <form class="panel-body form-horizontal form-padding">
            <div class="form-group">
                <div class="col-md-3">
                    <div class="radio">
                        <input id="settingType1" type="radio" name="settingType" value="3" <#if ((contractInfo.planType)?? && contractInfo.planType == 1) || (contractSetting?? && contractSetting.cooperationType == 1)>checked</#if> >
                        <label for="demo-form-radio">分成</label>
                    </div>
                </div>
                <div class="col-md-3">
                    <#if (contractInfo.planType)?? && contractInfo.planType == 1>
                        <input type="text" id="companyRate" name="companyRate" value="10" onchange="changeCustomerRate()" class="form-control" placeholder="公司比例">
                    <#elseif contractSetting?? && contractSetting.cooperationType == 1>
                        <input type="text" id="companyRate" name="companyRate" value="${100-(contractSetting.longAgreementRate)!0}" onchange="changeCustomerRate()" class="form-control" placeholder="公司比例">
                    <#else>
                        <input type="text" id="companyRate" name="companyRate" value="" onchange="changeCustomerRate()" class="form-control" placeholder="公司比例">
                    </#if>
                </div>
                <div class="col-md-2">
                    <span>(%)</span>&nbsp; <span>：</span>
                </div>
                <div class="col-md-3">
                    <#if (contractInfo.planType)?? && contractInfo.planType == 1>
                        <input type="text" id="customerRate" name="customerRate" value="90" disabled class="form-control" placeholder="客户比例">
                    <#elseif contractSetting?? && contractSetting.cooperationType == 1>
                        <input type="text" id="customerRate" name="customerRate" value="${(contractSetting.longAgreementRate)!}" disabled class="form-control" placeholder="客户比例">
                    <#else>
                        <input type="text" id="customerRate" name="customerRate" value="" disabled class="form-control" placeholder="客户比例">
                    </#if>
                </div>
                <div class="col-md-1"><span>(%)</span></div>
            </div>
            <div class="form-group"  id="customerRate_err" style="display: none">
                <label class="col-md-3 control-label" for="demo-email-input"></label>
                <div class="col-md-6">
                    <small class="help-block">请输入分成比例，用户比例+公司比例=100</small>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3">
                    <div class="radio">
                        <input id="settingType2" type="radio" value="4" name="settingType" <#if (contractSetting?? && contractSetting.cooperationType == 2)>checked</#if>>
                        <label for="demo-form-radio">保底价格</label>
                    </div>
                </div>
                <div class="col-md-9 input-group mar-btm">
                    <input type="text" class="form-control" id="bottomPrice" name="bottomPrice" value="${(contractSetting.bottomPrice)!}" placeholder="">
                    <span class="input-group-addon">分/度kWh</span>
                </div>
            </div>
            <div class="form-group"  id="bottomPrice_err" style="display: none">
                <label class="col-md-3 control-label" for="demo-email-input"></label>
                <div class="col-md-6">
                    <small class="help-block">请输入保底价格</small>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3">
                    <div class="radio">
                        <input id="settingType3" type="radio" value="5" name="settingType" <#if (contractSetting?? && contractSetting.cooperationType == 4)>checked</#if>>
                        <label for="demo-form-radio">自定义</label>
                    </div>
                </div>
                <div class="col-md-9">
                    <textarea id="description" name="description" class="form-control" rows="3">${(contractSetting.description)!}</textarea>
                    <small class="help-block" id="description_err" style="display: none">请输入自定义内容</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">签约年限</label>
                <div class="col-md-9 input-group mar-btm">
                    <input type="text" id="tradeCycle" name="tradeCycle" value="${(contractInfo.tradeCycle)!}" class="form-control" placeholder="">
                    <span class="input-group-addon">年</span>
                </div>
            </div>
            <div class="form-group"  id="tradeCycle_err" style="display: none">
                <label class="col-md-3 control-label" for="demo-email-input"></label>
                <div class="col-md-6">
                    <small class="help-block">请输入签约年限</small>
                </div>
            </div>
            <!--<div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">生效时间</label>
                <div class="col-md-9">
                    <input type="text" id="startAt" name="startAt" value="" class="form-control" placeholder="">
                    <small class="help-block" id="startAt_err" style="display: none">请输入生效时间</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label" for="demo-email-input">失效时间</label>
                <div class="col-md-9">
                    <input type="text" id="endedAt" name="endedAt" value="" class="form-control" placeholder="">
                    <small class="help-block" id="endedAt_err" style="display: none">请输入失效时间，失效时间需大于生效时间</small>
                </div>
            </div>-->
            <div class="form-group">
                <div class="col-md-3">
                    <input type="hidden" id="detailId" name="detailId" value="${(detailInfo.id)!}" />
                    <input type="hidden" id="companyId" name="companyId" value="${(companyInfo.id)!}" />
                    <input type="hidden" id="contractId" name="contractId" value="${(contractInfo.id)!}" />
                    <button type="button" class="btn btn-success" onclick="editInfo()">保存</button>
                </div>
                <div class="col-md-9"><span id="totalError" style="color:red;display: none">您有信息没有填写完整，请补充完整。</span></div>
            </div>
        </form>
    </div>
</div>
<script src="<@spring.url "/resources/plugins/bootstrap-select/bootstrap-select.min.js"/>"></script>
<#include "edit_js.ftl"/>